#include <stdio.h>
#include <stdint.h>									//	Standard int types

#include "ansiterm.h"

//
//	Local constants
//
static const	uint16_t	FG_offset = 30;
static const	uint16_t	BG_offset = 40;

void AnsiTerm_clr_screen(void)
{
	printf("\x1B[2J");							// clear the screen
	printf("\x1B[0m");							// color mode reset
}

void AnsiTerm_clr_line(void)
{
	printf("\x1B[2K");							// clear the line
}

void AnsiTerm_fgcolor_set(ANSI_COLOR color)
{
	printf("\x1B[3%1dm",color);					// set the foreground color
}

void AnsiTerm_bgcolor_set(ANSI_COLOR color)
{
	printf("\x1B[4%1dm",color);					// set the background color
}

void AnsiTerm_color_reset(void)
{
	printf("\x1B[0m");							// set the foreground/background color
}

void AnsiTerm_goto(uint16_t x, uint16_t y)
{
	printf("\x1B[%d;%dH",y,x);					// set the foreground color
}

void AnsiTerm_cursor_up(uint16_t cells)
{
	printf("\x1B[%dA",cells);					// move cells up
}

void AnsiTerm_cursor_down(uint16_t cells)
{
	printf("\x1B[%dB",cells);					// move cells up
}

void AnsiTerm_cursor_fwd(uint16_t cells)
{
	printf("\x1B[%dC",cells);					// move cells up
}

void AnsiTerm_cursor_back(uint16_t cells)
{
	printf("\x1B[%dD",cells);					// move cells up
}

//
//	End of:	ansiterm.c
//
